using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace QLTV.HeThongGiaoDien
{
    public partial class F_TheLoaiSach : DevExpress.XtraEditors.XtraForm
    {
        private int row = 0;
        public F_TheLoaiSach()
        {
            InitializeComponent();
        }

        void HienThiDanhSach()
        {
            DataTable dt = HeThongXuLy.SachDB.DanhSachTheLoai();
            if (dt.Rows.Count != 0)
            {
                if (row < dt.Rows.Count)
                {
                    if (row < 0)
                    {
                        row = 0;
                        txtMaTL.Text = dt.Rows[0][0].ToString();
                        txtTenTL.Text = dt.Rows[0][1].ToString();
                    }
                    else
                    {
                        txtMaTL.Text = dt.Rows[row][0].ToString();
                        txtTenTL.Text = dt.Rows[row][1].ToString();

                    }

                }
                else
                {
                    row = dt.Rows.Count - 1;

                }
            }
        }
        private void B_Exit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void B_Pre_Click(object sender, EventArgs e)
        {
            row--;
            HienThiDanhSach();
        }

        private void B_Next_Click(object sender, EventArgs e)
        {
            row++;
            HienThiDanhSach();
        }

        private void F_TheLoaiSach_Load(object sender, EventArgs e)
        {
            HienThiDanhSach();
        }
    }
}